package com.example.gulimall.product.web;

import com.example.common.constant.ProductConstant;
import com.example.gulimall.product.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * <p>
 *
 * </p>
 *
 * @author zyred
 * @since v 0.1
 **/
@Controller
public class IndexController {

    @Autowired private CategoryService categoryService;

    @GetMapping ({"/", "index", "index.html"})
    public String index(Model model) {
        model.addAttribute("categorys", this.categoryService.getCategoryByLevel(ProductConstant.CateLogLevel.LEVEL_1.getCode(), 0L));
        return "index";
    }

}
